package com.ktr.controller;

import com.ktr.entity.KtrInfo;
import com.ktr.service.KtrInfoService;
import com.bhudy.base.QueryFilter;
import com.sys.utils.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author com.bhudy
 * @Description KtrInfoController
 * @Date 2019-10-30 23:09:37
 */
@RestController
public class KtrInfoController {

    @Autowired
    private KtrInfoService ktrInfoService;

    @GetMapping(value = "/api/v1/ktrInfos")
    public Object getAll(){
        QueryFilter queryFilter = new QueryFilter();
        queryFilter.clear();
        return RequestUtils.printMapJson(0, ktrInfoService.findList(queryFilter));
    }

    @GetMapping(value = "/api/v1/ktrInfo")
    public Object get(Long ktrId) {
        return RequestUtils.printMapJson(0, ktrInfoService.get(ktrId));
    }

    @PostMapping(value = "/api/v1/ktrInfo")
    public Object insert(KtrInfo ktrInfo){
        return RequestUtils.printMapJson(0, ktrInfoService.insert(ktrInfo));
    }

    @PutMapping(value = "/api/v1/ktrInfo")
    public Object update(KtrInfo ktrInfo){
        return RequestUtils.printMapJson(0, ktrInfoService.update(ktrInfo));
    }

    @DeleteMapping(value = "/api/v1/ktrInfo")
    public Object delete(Long[] ktrId) {
        return RequestUtils.printMapJson(0, ktrInfoService.delete(ktrId));
    }

}
